<template>
	<view class="father">
		<view style="display: flex;align-items: center">
			<view>
				<up-avatar size="80" :src="$img+userStore.userInfo.avatar"></up-avatar>
			</view>
			<view style="margin-left: 20rpx;">
				<up--text size="25" :text="userStore.userInfo.userNickname" />
				<up-button class="custom-style" text="编辑个人信息"></up-button>
			</view>
			<view @click="goSetting">
				<uni-icons type="gear-filled" size="30"></uni-icons>
				<view>设置</view>
			</view>
		</view>
		<uni-card padding="0px" spacing="0px" margin="0px">
			<up-cell-group>
				<up-cell icon="file-text" title="我的订单" value="查看全部"></up-cell>
			</up-cell-group>
		</uni-card>
		<up-cell-group>
			<up-cell icon="integral-fill" :isLink="true" title="收货地址" ></up-cell>
		</up-cell-group>
	</view>
</template>

<script setup>
	import {
		useUserStore
	} from '../../store/user.js'

	const userStore = useUserStore()

	function goSetting() {
		uni.navigateTo({
			url: "/pages/setting/index"
		})
	}
	onLaunch:function(){
		if(!userStore.isLogin){
			// 如果没有登录，则跳转到登录页
			uni.navigateTo("/pages/login/login")
		}
	}
</script>

<style lang="scss">
	.father {
		padding: 20px;
		background-color: #F7F7FA;

		.order-box {
			margin-top: 20px;
		}
	}
</style>